<script src="./jessibuca.js"></script>
<script src="./decoder.js"></script>
<script src="./decoder.wasm"></script>
<div id="container" style="width: 500px;height: 500px;"></div>
<!-- <video id="video" width="200" controls ></video> -->
<script>
      const p = new Jessibuca({
                container: document.getElementById("container"),
                //decoder: "/Content/js/AKStream/decoder.js",
                videoBuffer: 0, // 缓存时长
                isResize: false,
                text: "",
                loadingText: "加载中",
                debug: true,
                showBandwidth: true, // 显示网速
                operateBtns: {
                    fullscreen: true,
                    screenshot: true,
                    play: true,
                    audio: true,
                    record: true
                },
                forceNoOffscreen: true,
                isNotMute: false,
                heartTimeout: 100,
            });
   p.play('http://192.168.3.4:8088/001/10ECC3DA.live.flv');
    //p.play('http://192.168.3.4:8088/001/10ECC3DA/hls.m3u8');



</script>
 <!-- <script>
        // 1. 初始化MediaSource
        const video = document.getElementById('video');
        const mediaSource = new MediaSource();
        video.src = URL.createObjectURL(mediaSource);

        mediaSource.addEventListener('sourceopen', async () => {
            // 2. 获取FLV文件（示例通过fetch获取）
            const response = await fetch('http://192.168.3.4:8088/001/10ECC3DA.live.flv');
            const reader = response.body.getReader();
            
            // 3. 创建SourceBuffer（假设H.264视频 + AAC音频）
            const videoBuffer = mediaSource.addSourceBuffer(
                'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
            );
            
            // 4. 简易FLV解析器（仅关键逻辑）
            const parseFLV = (chunk) => {
                // 实际实现需完整解析FLV Header/Tags
                // 此处简化为直接转换（伪代码）
                const fmp4Chunk = convertFLVtoFMP4(chunk); 
                return fmp4Chunk;
            };

            // 5. 流式处理FLV数据
            while (true) {
                const { done, value } = await reader.read();
                if (done) break;
                
                // 将FLV chunk转成fMP4
                const fmp4Chunk = parseFLV(value);
                
                // 6. 追加到MediaSource
                if (!videoBuffer.updating) {
                    videoBuffer.appendBuffer(fmp4Chunk);
                } else {
                    // 处理更新队列（实际需更完善）
                    videoBuffer.addEventListener('updateend', () => {
                        videoBuffer.appendBuffer(fmp4Chunk);
                    }, { once: true });
                }
            }
        });
    </script> -->